package cn.edu.jxust.core.infrastructure.mapper;

import cn.edu.jxust.common.domain.entity.SiteAirType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

/**
 * @author QiuKangming
 * @since 2020-07-06
 */

public interface SiteAirTypeMapper extends BaseMapper<SiteAirType> {

    /**
     * 根据监测点id查询该监测点监测的气体列表
     * @param siteId 监测点id
     * @return List<Integer>
     */
    @Select("SELECT airtype_id FROM t_site_airtype WHERE site_id = #{siteId} AND status = 1")
    List<Integer> getAirIdListBySiteId(Integer siteId);

    /**
     * 根据监测点id查询该监测点是否有监测气体
     * @param siteId 监测点id
     * @return int
     */
    @Select("SELECT COUNT(1) FROM t_site_airtype WHERE site_id = #{siteId} AND status = 1")
    int getCountBySiteId(Integer siteId);

}
